package com.zhao.biz.tag.perform

import org.apache.spark.sql.Row

/**
 * Description: 设备标签<br/>
 * Copyright (c) ，2021 ， 赵 <br/>
 * A wet person does not fear the rain. <br/>
 * Date： 2021/1/14 14:47
 *
 * @author 柒柒
 * @version : 1.0
 */

object TagsDevice extends IMakeTags {
  /**
   * 数据标签接口
   *
   * @param args
   * @return
   */
  override def makeTags(args: Any*): List[(String, Int)] = {
    var list: List[(String, Int)] = List[(String, Int)]()

    val row: Row = args(0).asInstanceOf[Row]

    //操作系统
    val client = row.getAs[Int]("client")
    client match {
      case 1 => list :+= ("D00010001",1)
      case 2 => list :+= ("D00010002",1)
      case 3 => list :+= ("D00010003",1)
      case _ => list :+= ("D00010004",1)
    }

    //设备联网方式
    val network = row.getAs[String]("networkmannername")
    network match {
      case "WIFI" => list :+= ("D00020001",1)
      case "4G" => list :+= ("D00020002",1)
      case "3G" => list :+= ("D00020003",1)
      case "2G" => list :+= ("D00020004",1)
      case _ => list :+= ("D00020005",1)
    }

    //运营商
    val ispname = row.getAs[String]("ispname")
    ispname match {
      case "移动" => list :+= ("D00030001",1)
      case "联通" => list :+= ("D00030002",1)
      case "电信" => list :+= ("D00030003",1)
      case _ => list :+= ("D00030004",1)
    }

    //List(("D00010001",1),("D00020001",1),("D00030001",1))
    list
  }
}



















